﻿<%@ page contentType="text/html; charset=UTF-8" language="java"%>

<%@page import="com.books4sale.admin.dto.Profile"%>
<%@page import="com.books4sale.admin.dto.tools.Helper"%>
<%@page import="javax.jdo.PersistenceManager"%>
<%@page import="com.books4sale.admin.dto.tools.PMF"%>
<%@page import="com.google.appengine.api.datastore.Key"%>
<%@page import="com.google.appengine.api.datastore.KeyFactory"%><html
	lang="ar">
<head>
<meta content="text/html; charset=UTF-8; http-equiv='Content-Type'">
<title>معلومات المستخدم</title>
</head>
<body>
<div class="top-bar">
<h1>معلومات المستخدم</h1>
<div class="breadcrumbs"></div>
</div>
<div id="spacer" style="height: 84px"></div>
<div style="display: block;" class="table" id="userInfoPane">
<%
	PersistenceManager pm = PMF.get().getPersistenceManager();
	Key key = KeyFactory.createKey(Profile.class.getSimpleName(),
			Helper.get().getCurrentUser().getEmail());
	Profile userProfile = Helper.get().isUserProfileExists();
	if( null == userProfile) userProfile = new Profile();
	
%>
<form id="userInfoForm" action="/admin/saveProfile" method="post"
	accept-charset="UTF-8" dir="rtl">
<table cellspacing="0" cellpadding="0" class="listing form">
	<tbody>
		<tr>
			<th colspan="2" class="full">معلومات المستخدم</th>
		</tr>
		<tr>
			<td width="172"><div style=" text-align: right" >
			<strong>اسم المحل</strong><span class="required">*</span></div>
			</td>
			<td><div style=" text-align: right" >
			<input id="name" name="name" type="text"
				value="<%=userProfile.getShopName()%>" class="text"></div></td>
		</tr>
		<tr>
			<td><div style=" text-align: right" >
			<strong>رقم الهاتف</strong><span class="required">*</span></strong></div>
			</td>
			<td><div style=" text-align: right" >
			<input id="phone" name="phone" type="text" class="text"
				value="<%=userProfile.getShopPhone()%>"></div>
				</td>
		</tr>
		<tr>
			<td><div style=" text-align: right" >
			<strong>العنوان</strong><span class="required">*</span></strong></div></td>
			<td><div style=" text-align: right" >
			<textarea id="address" name="address" class="text"
				style="width: 266px;"><%=userProfile.getShopAddress()%></textarea></div>
				</td>
		</tr>
		<tr>
			<td><div style=" text-align: right" >
			<strong>المدينة</strong><span class="required">*</span></strong></div>
			</td>
			<td><div style=" text-align: right" >
			<select name="city" value="<%=userProfile.getShopCity()%>">
				<option>نابلس</option>
				<option>رام الله</option>
				<option>جنين</option>
				<option>الخليل</option>
				<option>بيت لحم</option>
				<option>القدس</option>
			</select>
			</div></td>
		</tr>
		<tr>
			<td colspan="2">
			<div style="width: 100%; text-align: center;"><input
				type="submit" value="حفظ" id="saveUserInfoButton" /></div>
			</td>
		</tr>
	</tbody>
</table>
<br/><br/><br/><br/><br/><br/><br/>
						<table cellspacing="0" cellpadding="0" class="listing form"  >
							<tbody ><tr>
								<th colspan="2" class="full">
								<div style="width: 100%; text-align: right" >اضف اعلانك</div></th>
							</tr>
							<tr>
								<td width="172"><div style=" text-align: right" >
								<strong> المعلومات اللازمه</strong><span class="required">*</span>
								</div>
								</td>
								<td><div style=" text-align: right" >
								<input id="BookName" name="BookName" type="text" class="text"></div>
								</td>
							</tr>
							<tr>
								<td><div style=" text-align: right" >
								<strong>سعر الكتاب</strong><span class="required">*</span>
								</div>
								</td>
								<td><div style=" text-align: right" >
								<input type="text" class="text"></div></td>
							</tr>
							<tr>
								<td height="24"><div style=" text-align: right" >
								<strong>صورة الكتاب</strong><span class="required">*</span>
								</div>
								</td>
								<td ><div style=" text-align: right" >
								<input type="file" id="FilePath"  ></div>
								</td>
							</tr>
								
							<tr>
								<td colspan="2"> <div style="width: 100%; text-align: center"><button id="ContinueButton">حفظ</button></div> </td>
							</tr>
						</tbody></table>
</form>
</div>
<script type="text/javascript">
/** view listeners : **/
//$("#saveUserInfoButton").click (function() {validateUserInfo();});
$("form").submit(function () {return validateUserInfo();});
</script>

</body>
</html>